<template>
	<view>
		<scroll-view scroll-y class="bg-white nav" @scroll="scroll">
			<view class="header flex text-center">
				<button @tap="GetNewOrderNo(false)">创建新单</button>
				<button @tap="clearAll">清空单据</button>
				<button @tap="lookOrder()">查询单据</button>
				<button @tap="isChangeOrder()" v-if="!isChange">提交单据</button>
				<button @tap="isChangeOrder()" v-if="isChange">修改单据</button>
			</view>
			<view class="main">
				<view class="main-box">
					<form> 
						<view class="cg-main">
							<view class="tabHeader" :class="isLookHeaderMore?'tabHeaderMore':''">
								<view class="cu-form-group">
									<view class="title">*单据编号:</view>
									<input class="inpt" disabled="true" name="input" :value="BillNo" placeholder="创建新单获取单号"></input>
								</view>
								<view class="cu-form-group">
									<view class="title">*单据日期:</view>
									<!-- <view @tap="open()" class="inpt1">
										<input disabled="true" :value="timeData.fulldate" placeholder="单击选择"></input>
									</view> -->
									<picker mode="date" :value="endTime" @change="DateChange">
										<view class="picker">
											{{BillDate}}
										</view>
									</picker>
								</view>
								<view class="cu-form-group" v-if="BillType==13">
									<view class="title">*特价开始时间:</view>
									<!-- <view @tap="openStart()" class="inpt1">
										<input disabled="true" :value="startTime" placeholder="单击选择"></input>
									</view> -->
									<picker mode="date" :value="startTime" @change="DateChangeStart">
										<view class="picker">
											{{startTime}}
										</view>
									</picker>
								</view>
								<view class="cu-form-group" v-if="BillType==13">
									<view class="title">*特价结束时间:</view>
									<!-- <view @tap="openEnd()" class="inpt1">
										<input disabled="true" :value="endTime" placeholder="单击选择"></input>
									</view> -->
									<picker mode="date" :value="endTime" @change="DateChangeEnd">
										<view class="picker">
											{{endTime}}
										</view>
									</picker>
								</view>
								<view class="cu-form-group" v-if='BillName=="采购订单"&&BillName!="促销单"'>
									<view class="title">*供&nbsp;应&nbsp;商&nbsp;:</view>
									<view class="inpt1"><input type="text" placeholder="点击获取" :value="SelectClientObj.ClientName" disabled="true"
										 style="text-align: left;" @tap="AddClientListen()" /></view>
								</view>
								<view class="cu-form-group" v-if='BillName!="采购订单"&&BillName!="促销单"'>
									<view class="title">*客&emsp;&nbsp;&nbsp;户&nbsp;:</view>
									<view class="inpt1"><input type="text" placeholder="点击获取" :value="SelectClientObj.ClientName" disabled="true"
										 style="text-align: left;" @tap="AddClientListen()" /></view>
								</view>
								<view class="cu-form-group">
									<view class="title">*仓&emsp;&nbsp;&nbsp;库&nbsp;:</view>
									<view class="inpt1"><input type="text" placeholder="点击获取" :value="SelectStoreObj.StoreName" disabled="true"
										 style="text-align: left;" data-target="StoreModal" @tap="showModal" />
										<view class="cu-modal" :class="modalName=='StoreModal'?'show':''">
											<view class="cu-dialog">
												<view class="cu-bar bg-white justify-end">
													<view class="content">请选择仓库</view>
													<view class="action" @tap="hideModal">
														<text class="cuIcon-close text-red"></text>
													</view>
												</view>
												<view class="padding-xl">
													<view class="searchStore">
														<input placeholder="请输入仓库名称" v-model="SearchStoreName" @input="filterStore" />
														<button @tap="searchStore">搜索</button>
													</view>
													<view class="StoreListWrap">
														<view v-for="(item,index) in TempStoreList" :key="item.StoreID" @tap="selectStore(index)">{{item.StoreName}}</view>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="cu-form-group" v-if="BillType==1||BillType==13">
									<view class="title">业&nbsp;务&nbsp;员&nbsp;:</view>
									<view class="inpt1"><input type="text" placeholder="点击获取" :value="SelectOptionsObj.OperatorName" disabled="true"
										 style="text-align: left;" data-target="OptionModal" @tap="showModal" />
										<view class="cu-modal" :class="modalName=='OptionModal'?'show':''">
											<view class="cu-dialog">
												<view class="cu-bar bg-white justify-end">
													<view class="content">选择业务员</view>
													<view class="action" @tap="hideModal">
														<text class="cuIcon-close text-red"></text>
													</view>
												</view>
												<view class="padding-xl">
													<view class="searchStore">
														<input placeholder="请输入业务员名称" v-model="SearchOptionName" @input="filterOption" />
														<button @tap="searchOption">搜索</button>
													</view>
													<view class="StoreListWrap">
														<view v-for="(item,index) in TempOptionList" :key="item.OperatorID" @tap="selectOptions(index)">{{item.OperatorName}}</view>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="cu-form-group">
									<view class="title">制&nbsp;单&nbsp;人&nbsp;:</view>
									<input class="inpt" disabled="true" name="input" :value="CreateName" style="text-align: left;"></input>
								</view>
								<view class="cu-form-group">
									<view class="title">备&emsp;&nbsp;&nbsp;&nbsp;注:</view>
									<input class="inpt" name="input" v-model="Remark"></input>
								</view>
								<view class="cu-form-group lookHeaderMore">
									<view class="title" style="width: 100%;text-align: center;" @tap="lookHeaderMore()">{{TbHeaderMore}}</view>
								</view>
							</view>
							<view>
								<view class="searchInput">
									<view class="goodFilter">
										<uniIcon type="search" size="14" style="line-height: 28px;margin-left: 5px;margin-right: 5px;color: #a7aab3;" />
										<input placeholder="输入条码进行搜索" class="searchOption" confirm-type="search" type="text" @confirm="search()"
										 v-model="searchKey"></input>
									</view>
									<view class="searchOptions">
										<button class="giveSong" @tap="gogoodlist()"></button>
										<button class="getPicture" @tap="tel()"></button>
									</view>
									<view class="cu-modal" :class="modalName=='StoreScanGoodModal'?'show':''">
										<view class="cu-dialog">
											<view class="cu-bar bg-white justify-end">
												<view class="content">请选择商品</view>
												<view class="action" @tap="hideModal">
													<text class="cuIcon-close text-red"></text>
												</view>
											</view>
											<view class="padding-xl">
												<view class="GoodsListWrap">
													<view v-for="(item,index) in scanGoodList" :key="item.GoodsCode" @tap="selectGoodsList(index)">
														<image :src="item.Goods_Image_Path1" v-if="item.Goods_Image_Path1!=''&&item.Goods_Image_Path1!='underfind'"
														 mode="aspectFill"></image>
														<image :src="unLoadimg" mode="aspectFill" v-else></image>
														<text>{{item.GoodsName}}</text>
													</view>
												</view>
											</view>
										</view>
									</view>
								</view>
								<view class="nowGoodCount"><view>商品数:{{OrderGoodsListLength}}</view>
									<view>商品总金额:<text class="red">￥{{goodAllAmount}}</text></view></view>
							</view>
							<addOrderList :OrderGoodsList="OrderGoodsList" @deleteSelectGood="deleteSelectGood" @changeInfo="changeInfo" v-if="!isChangeShow"></addOrderList>
							<selectSimple :OrderGoodsList="OrderGoodsList" @deleteSelectGood="deleteSelectGood" @changeInfo="changeInfo"  v-else></selectSimple>
						</view>
					</form>
				</view>
			</view>
		</scroll-view>
		<view class="quiteTop" v-if="isShowTip" @tap="scrollTop">返回</br>顶部</view>
		<!-- 单据日期选择 -->
		<uni-calendar ref="calendar" :insert="false" @confirm="confirm" />
		<!-- 特价开始时间日期选择 -->
		<uni-calendar ref="calendar2" :insert="false" @confirm="confirm1" />
		<!-- 特价结束日期选择 -->
		<uni-calendar ref="calendar3" :insert="false" @confirm="confirm2" />
		
		<settingOption :settingObj="'setting'+BillType" :modalName="modalName"
		 @changeSetting="changeSetting" @ycDy="ycDy" @djSh="djSh" @PrintOrder="PrintOrder" @hideModal="hideModal" :modalNames="modalNames" @radioChange="radioChange"
		@getPrintNum="getPrintNum" ref="settingOption" :BillType="BillType" @changeSelectShow="changeSelectShow" @xpDy="xpDy"></settingOption>
	</view>
</template>
<script src="./js/addCgOrder.js">
</script>

<style>
	@import url("./css/addCgOrder.css");
</style>
